<script setup>
const props = defineProps({
  placeholder: String,
  type: String,
  error: Array,
})

const emits = defineEmits(['update:modelValue'])



</script>

<template>
  <div class="inputBlock">
  <input :type="type" :placeholder="placeholder" @input="$emit('update:modelValue', $event.target.value)" :class="{input_error: error}">
    <transition name="fade">
      <span class="error" v-if="error">{{error.join(' ')}}</span>
    </transition>
  </div>
</template>

<style scoped>
  .error {
    position: absolute;
    bottom: 0;
    left: 0;
    padding-left: 5px;
    color: #fc243d;
    font-size: 14px;
    transition: all;
    line-height: 25px;
  }

  .inputBlock {
    width: 100%;
    position: relative;
  }

  .input_error {
    border: #ff3e51 solid 3px;
    box-shadow: none;
  }

  .input_error:focus {
    border: #ff3e51 solid 3px;
    box-shadow: none;
  }

  input {
    width: 100%;
    background: #2c3e50;
    outline: none;
    padding: 11px 13px;
    border-radius: 24px;
    color: white;
    font-size: 16px;
    margin-bottom: 25px;
    transition: all ease-in-out .25s, margin-bottom 0s;
    border: #2c3e50 solid 3px;
  }

  input:focus {
    border: #42b883 solid 3px;
    box-shadow: 0px 0px 7px 3px #42b883;
  }

  input::placeholder {
    color: aliceblue;
  }

  .fade-enter-active, .fade-leave-active {
  transition: all .5s;
}
.fade-enter, .fade-leave-to {
  opacity: 0;
}

</style>